<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<script src="../../resources/js-test.js"> </script>
<script>
window.jsTestIsAsync = true;

function test() {
    document.forms.f.submit();
}
</script>
<body onload="test()">
<p>Test that when dirname attribute is specified then it is added in submission body.</p>

<div dir="auto">
    <form action="#action" method="GET" name="f">
        <div dir="rtl"> 
            <input type=text name="comment" dirname="rtlAncestor.dir" required>
        </div>
        <input type=text name="autoAncestor" dirname="autoAncestor.dir" value="שלום">
        <p><button name="mode" type=submit value="add">Post Comment</button></p>
    </form>
Hello
</div>

<div id="console"></div>
<div id="action">
<script>
if (document.location.href.match('\\?')) {
    shouldBeTrue('document.location.search.indexOf("rtlAncestor.dir=rtl") != -1');
    shouldBeTrue('document.location.search.indexOf("autoAncestor.dir=ltr") != -1');
    finishJSTest();
}

successfullyParsed = true;
</script>
</div>
</body>
</html>
